#include<stdio.h>

int search( int n )
{
    int num = 0;
    for (int i = 0; i*i < n; i++)
    {
        if (i*i >= 101 && i*i <= n)
        {
            if ((i*i)/100 == (i*i)%10 || ((i*i)%100)/10 == (i*i)%10 || (i*i)/100 == ((i*i)%100)/10)
            {
                num++;
            }
            
        }
        
    }
    
    return num;
}

int main(){    int number;    scanf("%d",&number);    printf("count=%d\n",search(number)); return 0;
}